#include "Noflash.h"

Noflash g_pNoflash;

void Noflash::Init()
{
	Active = false;
	BYTE FlashFindPatternA[] = {0x33, 0xC0, 0x39, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x94, 0xC0, 0xC3};
	OffsetA = *(DWORD**) (FindPattern::Find((DWORD)GetModuleHandleA(/*client.dll*/XorStr(10, 0xEE, 0x8D01850E, 0x841DC603, 0x8A090000).c_str()), 0x89B000 - 0x100, FlashFindPatternA, XorStr(FlashFindPatternB).c_str()) + FlashPatternOffset);

	BYTE FlashOffsetFindPatternA[] = {0x0F, 0x2F, 0x80, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x87, 0x00, 0x00, 0x00, 0x00, 0x8B, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x8B, 0x11, 0x8B, 0x82, 0x00, 0x00, 0x00, 0x00};
	OffsetB = *(DWORD*) (FindPattern::Find((DWORD)GetModuleHandleA(/*client.dll*/XorStr(10, 0xEE, 0x8D01850E, 0x841DC603, 0x8A090000).c_str()), 0x89B000 - 0x100, FlashOffsetFindPatternA, XorStr(FlashOffsetFindPatternB).c_str()) + FlashOffsetPatternOffset);
}

void Noflash::Enable()
{
	Active = true;
}

void Noflash::Disable()
{
	Active = false;
}

void Noflash::Set( bool Active )
{
	this->Active = Active;
}

void Noflash::Compute()
{
	if (Active)
	{
		*(float*) (*OffsetA + OffsetB) = 0.0f;
	}
}
